home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: dmocc2.on.bell.ca!bc2cep!news
- From: g2david@sprynet.com (David Leung)
- Subject: Array pointer?
- X-Nntp-Posting-Host: duncjm.on.bell.ca
- Message-ID: <DppIHL.MzF@on.bell.ca>
- Sender: news@on.bell.ca (news admin)
- Reply-To: g2david@sprynet.com (David Leung)
- Organization: Bell Canada, Bell Sygma, SRCI
- X-Newsreader: IBM NewsReader/2 v1.02
- Distribution: all
- Date: Thu, 11 Apr 1996 16:44:09 GMT
-
-
- if I write this
-
- int a[10];
- int *b1=a; <--- The pointer b points to the head of the array?
- int b2=a <--- What will we get?
- int b3=*a <--- what will we get?
- int *b4=*a <--- what will we get again?
-
- ; access like a[3]
- int *c1;
-
- c1= a+3
- cout << *c1; ?
- cout << c1; ?
-
- ; is this correct?
- int c2;
-
- c2 = *(a+3); ?
- cout << c2; ?
-
- ; is this correct, too?
- int *c3
-
- c3 = (a + 3 * sizeof(int) );
- count << *c3;
-
-
-
- I am very confused!
-
- Can anyone explain those to me, please!
-
- g2david
- :->
-